Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move disclosures to fetch-logic #8008

Merged
merged 2 commits into from
Nov 8, 2023
Merged

Move disclosures to fetch-logic #8008

merged 2 commits into from
Nov 8, 2023

Conversation

wpears
Copy link
Member

@wpears wpears commented Nov 6, 2023

@anselmbradford Suggested we could switch to fetch here and I agree!

cypress tests should pass and the app should work identically to the disclosures branch

Also fixes a few random bugs that I found, eg, guards school access in the template, elements access in dollar-sign.js, and fixes financialInputChangeListener to target a real selector.

@wpears wpears requested a review from mistergone November 6, 2023 21:31
@wpears wpears force-pushed the fetch-disclosures branch from 3e937fe to 715199f Compare November 7, 2023 19:24
@@ -83,7 +83,7 @@ <h2 class="verify_prompt">
</h2>
<form class="verify_form">
<div class="verify_school">
{{school.primary_alias}}
{% if school%}{{school.primary_alias}}{% endif %}
Copy link
Member

@anselmbradford anselmbradford Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of all the conditionals, would it make sense to have something like this at the top:

{% set school_primary_alias = school.primary_alias if school else '' %}

And then {{ school_primary_alias }} in the spots where it is used?

If you do keep the conditions, perhaps format them the same as {% if school %}, instead of a mix of that and {% if school%}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I just did it with a mass replace in vim ^^;

Copy link
Member Author

@wpears wpears Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 79c3f37

@@ -130,16 +89,14 @@ const getApiValues = {
const warning = document
.querySelector('[data-warning]')
.getAttribute('data-warning');
if (warning !== '' && typeof warning !== 'undefined') {
if (warning && !window.Cypress) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this code know about Cypress? It seems like whatever the need is here should be offloaded to the test logic.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is kinda gross, the problem is though that the data isn't available in the test db, so this warning code will always trigger, even though the actual http requests are stubbed.

Putting this logic here allows Cypress to skip the warning code (which we want) and, in normal use of the app, allows the warning conditional to trigger when we need it.

I think maybe the best solution would be rearchitecting how the warning logic works/how the warning is propagated from the backend to the frontend, but that seemed out of scope.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'd be happy to fast-follow that because this is pretty gross. 😁

@wpears wpears merged commit 9481fba into disclosures Nov 8, 2023
14 of 15 checks passed
@wpears wpears deleted the fetch-disclosures branch November 8, 2023 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants